package com.gjy.kafka.k11;

import org.apache.kafka.clients.admin.*;

import java.util.Collection;
import java.util.Properties;

/**
 * @author gjy
 * @version 1.0
 * @since 2025-11-03 14:14:39
 */
public class KafkaAdmin {

    private final AdminClient client;

    public KafkaAdmin(Properties properties) {
        this.client = KafkaAdminClient.create(properties);
    }

    public CreateTopicsResult createTopic(Collection<NewTopic> topics) {
        return this.client.createTopics(topics);
    }

    public DescribeTopicsResult describeTopic(Collection<String> topics) {
        return this.client.describeTopics(topics);
    }

    public ListTopicsResult listTopic() {
        return this.client.listTopics();
    }

    public void close() {
        this.client.close();
    }

}
